<template>
  <div>
   学生年龄总和：
   <p>{{ isAllage }}</p>
  </div>
</template>

<script>
export default {
  data() {
   return {
    total:'',
     arr : [{
    name: "小明",
    age: 18
}, {
    name: "小花",
    age: 25
}, {
    name: "小爱",
    age: 21
}]
   }
  },
  computed:{
   isAllage() {
    return this.arr.reduce((item,obj) => {
       item += obj.age
       return item
    },0)
   }
  }
}
</script>

<style>
</style>